/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Public License. A 
 * copy of the license can be found in the License.html file at the root of this distribution. If 
 * you cannot locate the  Microsoft Public License, please send an email to 
 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
 * PARTICULAR PURPOSE.
 * ***************************************************************************/


#if !defined(AFX_PGLXCTL_H__54C7357C_3C30_4ADB_B696_FAC1A5035241__INCLUDED_)
#define AFX_PGLXCTL_H__54C7357C_3C30_4ADB_B696_FAC1A5035241__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// PGLXCtl.h : Declaration of the CPGLXCtrl ActiveX Control class.

/////////////////////////////////////////////////////////////////////////////
// CPGLXCtrl : See PGLXCtl.cpp for implementation.

class CPGLXCtrl : public COleControl
{
	DECLARE_DYNCREATE(CPGLXCtrl)

// Constructor
public:
	CPGLXCtrl();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPGLXCtrl)
	public:
	virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void DoPropExchange(CPropExchange* pPX);
	virtual void OnResetState();
	virtual DWORD GetControlFlags();
	//}}AFX_VIRTUAL

// Implementation
protected:
	gfxinterface::CGDIpInitializer	m_GDIpInitializer;
	gfxinterface::CGDIpInterface	m_GDIpInterface;
	CPGLRegionPtr m_pRegion;

	CPGLScript m_script;
	CPGLVectorFPtr SafeArrayToPGLData(const VARIANT FAR& sa);

protected:	
	~CPGLXCtrl();

	BEGIN_OLEFACTORY(CPGLXCtrl)        // Class factory and guid
		virtual BOOL VerifyUserLicense();
		virtual BOOL GetLicenseKey(DWORD, BSTR FAR*);
	END_OLEFACTORY(CPGLXCtrl)

	DECLARE_OLETYPELIB(CPGLXCtrl)      // GetTypeInfo
	DECLARE_PROPPAGEIDS(CPGLXCtrl)     // Property page IDs
	DECLARE_OLECTLTYPE(CPGLXCtrl)		// Type name and misc status

	// Subclassed control support
	BOOL IsSubclassedControl();
	LRESULT OnOcmCommand(WPARAM wParam, LPARAM lParam);

// Message maps
	//{{AFX_MSG(CPGLXCtrl)
		// NOTE - ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

// Dispatch maps
	//{{AFX_DISPATCH(CPGLXCtrl)
	CString m_sXMLFile;
	afx_msg void OnXMLFileChanged();
	CString m_sXMLString;
	afx_msg void OnXMLStringChanged();
	CString m_sXMLURL;
	afx_msg void OnXMLURLChanged();
	BOOL m_bAutoZoom;
	afx_msg void OnAutoZoomChanged();
	afx_msg long Figure();
	afx_msg BOOL SetCR(long lRegionID);
	afx_msg void CloseAllFigures();
	afx_msg void Divide(long lRegionID, short nRows, short nCols);
	afx_msg BSTR Get(long lObjectID, const VARIANT FAR& szProp);
	afx_msg long GetCR();
	afx_msg BSTR GetHelp(long lObjectID);
	afx_msg long GetParent(long lObjectID);
	afx_msg long Histogram(long lRegionID, const VARIANT FAR& saValues, const VARIANT FAR& szFormat);
	afx_msg long Plot(long lObjectID, const VARIANT FAR& saX, const VARIANT FAR& saY, const VARIANT FAR& szFormat);
	afx_msg long Legend(long lRegionID, const VARIANT FAR& szState); 
	afx_msg long PlotLOD(long lRegionID, const VARIANT FAR& saX, const VARIANT FAR& saY, float fCompRatio, const VARIANT FAR& szFormat);
	afx_msg void Title(long lRegionID, const VARIANT FAR& szText);
	afx_msg void XLabel(long lRegionID, const VARIANT FAR& szText);
	afx_msg void YLabel(long lRegionID, const VARIANT FAR& szText);
	afx_msg BOOL RenderToFile(long lRegionID, const VARIANT FAR& szFileName, const VARIANT FAR& szFormat);
	afx_msg long Region();
	afx_msg long GetChild(long lRegionID, long lIndex);
	afx_msg void ClearRegion(long lRegionID);
	afx_msg void Set(long lObjectID, const VARIANT FAR& szPropAndValues);
	afx_msg void OutOfChild();
	afx_msg BOOL SaveToXml(long lRegionID, const VARIANT FAR& szFileName, short bZipped);
	afx_msg BOOL LoadFromXML(long lRegionID, const VARIANT FAR& szFileName);
	afx_msg long Stock(long lRegionID, const VARIANT FAR& saOpen, const VARIANT FAR& saHigh, const VARIANT FAR& saLow, const VARIANT FAR& saClose, const VARIANT FAR& szFormat);
	afx_msg long Scatter(long lRegionID, const VARIANT FAR& saX, const VARIANT FAR& saY, const VARIANT FAR& saValues, const VARIANT FAR& szFormat);
	afx_msg long ErrorBar(long lRegionID, const VARIANT FAR& saX, const VARIANT FAR& saY, const VARIANT FAR& saErrorUp, const VARIANT FAR& saErrorDown, const VARIANT FAR& szFormat);
	//}}AFX_DISPATCH
	DECLARE_DISPATCH_MAP()

	afx_msg void AboutBox();

// Event maps
	//{{AFX_EVENT(CPGLXCtrl)
	//}}AFX_EVENT
	DECLARE_EVENT_MAP()

// Dispatch and event IDs
public:
	enum {
	//{{AFX_DISP_ID(CPGLXCtrl)
	dispidXMLFile = 1L,
	dispidXMLString = 2L,
	dispidXMLURL = 3L,
	dispidAutoZoom = 4L,
	dispidFigure = 5L,
	dispidSetCR = 6L,
	dispidCloseAllFigures = 7L,
	dispidDivide = 8L,
	dispidGet = 9L,
	dispidGetCR = 10L,
	dispidGetHelp = 11L,
	dispidGetParent = 12L,
	dispidHistogram = 13L,
	dispidPlot = 14L,
	dispidLegend = 15L,
	dispidPlotLOD = 16L,
	dispidTitle = 17L,
	dispidXLabel = 18L,
	dispidYLabel = 19L,
	dispidRenderToFile = 20L,
	dispidGetChild = 21L,
	dispidClearRegion = 22L,
	dispidSet = 23L,
	dispidOutOfChild = 24L,
	dispidSaveToXml = 25L,
	dispidLoadFromXML = 26L,
	dispidStock = 27L,
	dispidScatter = 28L,
	dispidErrorBar = 29L,
	//}}AFX_DISP_ID
	};
protected:

};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PGLXCTL_H__54C7357C_3C30_4ADB_B696_FAC1A5035241__INCLUDED)
